﻿CREATE TABLE [dbo].[SynonymEntities] (
    [ID]            INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
    [EntityID]      INT NOT NULL,
    [SynoID]        INT NOT NULL,
    [CaseSensitive] BIT CONSTRAINT [DF_Synonyms_CaseSensitive] DEFAULT ((1)) NOT NULL,
    [IsActive]      BIT CONSTRAINT [DF__Synonyms__IsActi__4CA06362] DEFAULT ((1)) NOT NULL,
    CONSTRAINT [PK_Synonyms] PRIMARY KEY CLUSTERED ([ID] ASC),
    CONSTRAINT [FK_SynonymEntities_Synonyms] FOREIGN KEY ([SynoID]) REFERENCES [dbo].[Synonyms] ([ID]) ON DELETE CASCADE ON UPDATE CASCADE
);


GO
CREATE NONCLUSTERED INDEX [ix_IsActive>]
    ON [dbo].[SynonymEntities]([IsActive] ASC)
    INCLUDE([ID]);


GO
CREATE NONCLUSTERED INDEX [ix_synoid]
    ON [dbo].[SynonymEntities]([SynoID] ASC)
    INCLUDE([ID]);


GO
CREATE UNIQUE NONCLUSTERED INDEX [ix_entityid_synoid]
    ON [dbo].[SynonymEntities]([EntityID] ASC, [SynoID] ASC);


GO
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
    ON [dbo].[SynonymEntities]([IsActive] ASC)
    INCLUDE([EntityID], [SynoID]);


GO
CREATE STATISTICS [stat_synoid]
    ON [dbo].[SynonymEntities]([SynoID]);

